package com.yxq.mdt.app.modules.personal.presenter;

import com.yxq.mdt.app.base.BasePresenter;
import com.yxq.mdt.app.modules.personal.bean.CollectTopicListBean;
import com.yxq.mdt.app.modules.personal.bean.PublishBean;
import com.yxq.mdt.app.modules.personal.bean.TopicCommentBean;
import com.yxq.mdt.app.modules.personal.model.PublishModel;
import com.yxq.mdt.app.net.ApiModel;

public class PublishPresenter extends BasePresenter<IPublishContract.View, PublishModel> implements IPublishContract.Presenter {

    public PublishPresenter(IPublishContract.View rootView, PublishModel model) {
        super(rootView, model);
    }

    @Override
    public void selectTopicInfoList(int pageNum, int pageSize) {
        mBaseModel.selectTopicInfoList(pageNum, pageSize, new ApiModel.CommonCallback<PublishBean>() {
            @Override
            public void onSuccess(PublishBean data) {
                mRootView.onLoadListSuccess(data);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onLoadListFailed(errMsg);
            }
        });
    }

    public void selectMyTopicFavour(int pageNum, int pageSize) {
        mBaseModel.selectMyTopicFavour(pageNum, pageSize, new ApiModel.CommonCallback<CollectTopicListBean>() {
            @Override
            public void onSuccess(CollectTopicListBean data) {
                mRootView.onLoadToPicListSuccess(data);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onLoadToPicListFailed(errMsg);
            }
        });
    }

    public void selectMyTopicComment(int pageNum, int pageSize) {
        mBaseModel.selectMyTopicComment(pageNum, pageSize, new ApiModel.CommonCallback<TopicCommentBean>() {
            @Override
            public void onSuccess(TopicCommentBean data) {
                mRootView.onLoadTopicCommentListSuccess(data);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onLoadTopicCommentFailed(errMsg);
            }
        });
    }

    public void delGsTopicComment(String id) {
        mBaseModel.delGsTopicComment(id, new ApiModel.CommonCallback<String>() {
            @Override
            public void onSuccess(String data) {

            }

            @Override
            public void onError(String errMsg) {

            }
        });
    }
}
